import java.awt.event.*;
import java.awt.*;
public class RedFrame extends javax.swing.JFrame implements ActionListener{

	private static final long serialVersionUID = 1L;

	public RedFrame(){
        initComponents();
    }

    private void initComponents(){

        jPanel1 = new javax.swing.JPanel();
        Meniu = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        RED = new ButonRosu(jPanel1,Color.red);
        Exit = new FileExitCommand(jPanel1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
        	jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 460, Short.MAX_VALUE));
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 401, Short.MAX_VALUE));

        jMenu1.setText("Meniu");

        RED.setText("RED");
        jMenu1.add(RED);

       

        Exit.setText("Exit");
        jMenu1.add(Exit);

        Meniu.add(jMenu1);

        setJMenuBar(Meniu);

        RED.addActionListener(this);
        Exit.addActionListener(this);       

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING,
            javax.swing.GroupLayout.DEFAULT_SIZE,1366, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 768, Short.MAX_VALUE));

        pack();
    }

    public static void main(String args[]){
        java.awt.EventQueue.invokeLater(
        	new Runnable() {
        		public void run() {
        			new RedFrame().setVisible(true);
        		}
        	});
    }

    private FileExitCommand Exit;
    private javax.swing.JMenuBar Meniu;
    private ButonRosu RED;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JPanel jPanel1;
    
    public void actionPerformed(ActionEvent e){
        if(e.getSource()==RED){
            RED.execute();
        }
       
            else
                if(e.getSource()==Exit){
                    Exit.execute();
                }
    }

}
